import Request from "@/common/utils/request/index";

enum Api {
  GetAllBranches = "/jeecgboot/posBranch/getAllBranch",
  getUserOwnBranch = "/jeecgboot/posBranch/getUserOwnBranch",
  GetBranchesList = "/jeecgboot/posBranch/list",
  CreateBranch = "/jeecgboot/posBranch/addNewBranch",
  EditBranch = "/jeecgboot/posBranch/editBranch",
  ChangeBranch = "/jeecgboot/posBranch/changeBranch",
}

export const getAllBranches = () => {
  return Request.getInstance().send<any>({
    url: Api.GetAllBranches,
    method: "GET",
  });
};

export const getUserOwnBranch = () => {
  return Request.getInstance().send<any>({
    url: Api.getUserOwnBranch,
    method: "GET",
  });
};


export const getBranchesList = (params: any) => {
  return Request.getInstance().send<any>({
    url: Api.GetBranchesList,
    method: "GET",
    params,
  });
};

export const createBranch = (params: any) => {
  return Request.getInstance().send<any>({
    url: Api.CreateBranch,
    method: "POST",
    data: params,
  });
};

export const changeBranch = (branchId: string) => {
  return Request.getInstance().send<any>({
    url: Api.ChangeBranch,
    method: "POST",
    params: {
      branchId,
    },
  });
};
